<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><%= request.getParameter("title") != null ? request.getParameter("title") : "智慧康养社区" %></title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        /* 全局样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        :root {
            --primary: #2e7d32;
            --primary-light: #4caf50;
            --secondary: #0277bd;
            --dark: #2e2e2e;
            --light: #f5f5f5;
            --gray: #e0e0e0;
            --white: #ffffff;
            --shadow: 0 4px 6px rgba(0,0,0,0.1);
            --transition: all 0.3s ease;
        }

        body {
            background-color: #fafafa;
            color: var(--dark);
            line-height: 1.6;
        }

        .container {
            width: 100%;
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }

        /* 导航栏样式 */
        header {
            background-color: var(--white);
            box-shadow: var(--shadow);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .navbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 0;
        }

        .logo {
            display: flex;
            align-items: center;
            text-decoration: none;
        }

        .logo i {
            font-size: 28px;
            color: var(--primary);
            margin-right: 10px;
        }

        .logo-text {
            font-size: 22px;
            font-weight: 700;
            color: var(--primary);
        }

        .nav-links {
            display: flex;
            list-style: none;
        }

        .nav-links li {
            margin-left: 25px;
        }

        .nav-links a {
            text-decoration: none;
            color: var(--dark);
            font-weight: 500;
            padding: 8px 12px;
            border-radius: 4px;
            transition: var(--transition);
        }

        .nav-links a:hover,
        .nav-links a.active {
            background-color: rgba(46, 125, 50, 0.1);
            color: var(--primary);
        }

        .nav-right {
            display: flex;
            align-items: center;
        }

        .user-dropdown {
            position: relative;
        }

        .user-toggle {
            display: flex;
            align-items: center;
            cursor: pointer;
            padding: 6px 10px;
            border-radius: 4px;
            transition: var(--transition);
        }

        .user-toggle:hover {
            background-color: rgba(46, 125, 50, 0.1);
        }

        .user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: #e8f5e9;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--primary);
            font-size: 18px;
            margin-right: 8px;
        }

        .user-name {
            font-weight: 500;
            margin-right: 5px;
        }

        .dropdown-menu {
            position: absolute;
            top: 100%;
            right: 0;
            background-color: var(--white);
            border-radius: 6px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            width: 200px;
            overflow: hidden;
            display: none;
            z-index: 10;
        }

        .dropdown-menu.active {
            display: block;
        }

        .dropdown-menu a {
            display: block;
            padding: 12px 20px;
            text-decoration: none;
            color: var(--dark);
            transition: var(--transition);
        }

        .dropdown-menu a:hover {
            background-color: #f5f5f5;
            color: var(--primary);
        }

        .dropdown-divider {
            height: 1px;
            background-color: var(--gray);
            margin: 5px 0;
        }

        .notification-icon {
            position: relative;
            margin-right: 15px;
            font-size: 20px;
            color: var(--dark);
            cursor: pointer;
        }

        .notification-count {
            position: absolute;
            top: -5px;
            right: -5px;
            background-color: #f44336;
            color: white;
            border-radius: 50%;
            width: 20px;
            height: 20px;
            font-size: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        /* 页面标题样式 */
        .page-header {
            background-color: var(--white);
            padding: 30px 0;
            margin-bottom: 30px;
            box-shadow: var(--shadow);
        }

        .page-title {
            font-size: 28px;
            color: var(--primary);
            margin-bottom: 10px;
        }

        .page-subtitle {
            color: #666;
            font-size: 16px;
        }

        /* 响应式设计 */
        .menu-toggle {
            display: none;
            font-size: 24px;
            cursor: pointer;
            color: var(--primary);
        }

        @media (max-width: 992px) {
            .nav-links {
                position: absolute;
                top: 100%;
                left: 0;
                background: var(--white);
                width: 100%;
                flex-direction: column;
                box-shadow: var(--shadow);
                display: none;
                padding: 20px 0;
            }

            .nav-links.active {
                display: flex;
            }

            .nav-links li {
                margin: 10px 0;
                padding: 0 20px;
            }

            .menu-toggle {
                display: block;
                margin-left: 20px;
            }

            .nav-right {
                margin-left: auto;
            }
        }
    </style>
</head>
<body>
<header>
    <div class="container">
        <div class="navbar">
            <a href="memberHome.jsp" class="logo">
                <i class="fas fa-home-heart"></i>
                <span class="logo-text">活力长者社区</span>
            </a>

            <div class="menu-toggle">
                <i class="fas fa-bars"></i>
            </div>

            <ul class="nav-links">
                <li><a href="memberHome.jsp" class="active"><i class="fas fa-home"></i> 首页</a></li>
                <li><a href="ViewProfileServlet"><i class="fas fa-user"></i> 个人信息</a></li>
                <li><a href="HouseListServlet"><i class="fas fa-building"></i> 房产管理</a></li>
                <li><a href="ViewOccupantsServlet"><i class="fas fa-users"></i> 入住人管理</a></li>
                <li><a href="ServiceRequestServlet"><i class="fas fa-heart"></i> 生活服务</a></li>
            </ul>

            <div class="nav-right">
                <div class="notification-icon">
                    <i class="fas fa-bell"></i>
                </div>

                <c:if test="${not empty sessionScope.user}">
                    <div class="user-dropdown">
                        <div class="user-toggle">
                            <div class="user-avatar">
                                <i class="fas fa-user"></i>
                            </div>
                            <span class="user-name">${sessionScope.memberInfo.memberDetail.realName}</span>
                            <i class="fas fa-caret-down"></i>
                        </div>

                        <div class="dropdown-menu">
                            <a href="ViewProfileServlet"><i class="fas fa-user-cog"></i> 个人设置</a>
                            <div class="dropdown-divider"></div>
                            <a href="login.jsp"><i class="fas fa-sign-out-alt"></i> 退出登录</a>
                        </div>
                    </div>
                </c:if>
            </div>
        </div>
    </div>
</header>

<div class="page-header">
    <div class="container">
        <h1 class="page-title"><%= request.getParameter("title") != null ? request.getParameter("title") : "会员中心" %></h1>
        <p class="page-subtitle"><%= request.getParameter("subtitle") != null ? request.getParameter("subtitle") : "活力长者社区服务系统" %></p>
    </div>
</div>

<script>
    // 移动端菜单切换
    document.querySelector('.menu-toggle').addEventListener('click', function() {
        document.querySelector('.nav-links').classList.toggle('active');
    });

    // 用户下拉菜单切换
    document.querySelector('.user-toggle').addEventListener('click', function(e) {
        e.stopPropagation();
        document.querySelector('.dropdown-menu').classList.toggle('active');
    });

    // 点击页面其他区域关闭下拉菜单
    document.addEventListener('click', function(e) {
        if (!e.target.closest('.user-dropdown')) {
            document.querySelector('.dropdown-menu').classList.remove('active');
        }
    });
</script>